home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / jcool01.zip / EX6_8.C < prev    next >
C/C++ Source or Header  |  1992-09-28  |  1KB  |  31 lines

  1. //
  2. // Copyright (C) 1991 Texas Instruments Incorporated.
  3. //
  4. // Permission is granted to any individual or institution to use, copy, modify,
  5. // and distribute this software, provided that this complete copyright and
  6. // permission notice is maintained, intact, in all copies and supporting
  7. // documentation.
  8. //
  9. // Texas Instruments Incorporated provides this software "as is" without
  10. // express or implied warranty.
  11. //
  12.  
  13. #include <cool/Queue.h>                // COOL Queue class
  14. #include <cool/Random.h>            // COOL Random number class
  15.  
  16. #include <cool/Queue.C>
  17.  
  18. int main (void) {
  19.   CoolQueue<double> q1;                // CoolQueue of default size
  20.   CoolRandom r (SIMPLE, 1, 3.0, 9.0);        // Simple CoolRandom generator
  21.   for (int i = 0; i < 5; i++)            // Put five CoolRandom numbers
  22.     q1.put (r.next ());                // into the CoolQueue
  23.     cout << q1 << "\n";                // Output CoolQueue elements
  24.   for (q1.reset(); q1.next(); )            // For each element in CoolQueue
  25.     if (q1.value() < 4.5)            // If less than tolerance
  26.       q1.remove ();                // Remove from CoolQueue
  27.   cout << q1 << "\n";                // Output CoolQueue elements
  28.   return (0);
  29. }
  30.   
  31.